package com.live.shop.model;

import org.json.JSONObject;

import java.io.Serializable;

public class MusicModel  implements Serializable {
    int musicId;
    String musicName;//音乐名称
    String musicUrl;//音乐地址
    int playNum;//播放次数
    String createTime;

    public static JSONObject model2Json(MusicModel model){
        JSONObject json = new JSONObject();
        try {
            json.put("musicId",model.getMusicId());
            json.put("musicName",model.getMusicName());
            json.put("musicUrl",model.getMusicUrl());
            json.put("playNum",model.getPlayNum());
            json.put("createTime",model.getCreateTime());
        }catch (Exception e){
            e.printStackTrace();
        }
        return json;
    }
    public static MusicModel Json2model(JSONObject json){
        MusicModel model = new MusicModel();
        try {
            model.setMusicId(json.getInt("musicId"));
            model.setMusicName(json.getString("musicName"));
            model.setMusicUrl(json.getString("musicUrl"));
            model.setPlayNum(json.getInt("playNum"));
            model.setCreateTime(json.getString("createTime"));
        }catch (Exception e){
            e.printStackTrace();
        }
        return model;
    }
    
    public int getMusicId() {
        return musicId;
    }

    public void setMusicId(int musicId) {
        this.musicId = musicId;
    }

    public String getMusicName() {
        return musicName;
    }

    public void setMusicName(String musicName) {
        this.musicName = musicName;
    }

    public String getMusicUrl() {
        return musicUrl;
    }

    public void setMusicUrl(String musicUrl) {
        this.musicUrl = musicUrl;
    }

    public int getPlayNum() {
        return playNum;
    }

    public void setPlayNum(int playNum) {
        this.playNum = playNum;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
}
